package com.xbongbong.paas.service;

import com.alibaba.fastjson.JSONObject;
import com.xbongbong.paas.domain.entity.ext.PaasFormDataEntityExt;
import com.xbongbong.paas.field.FieldAttrEntity;
import com.xbongbong.paas.pojo.OperationsPojo;
import com.xbongbong.paas.toolbox.exception.XbbException;
import com.xbongbong.pro.businessrule.pojo.dto.OperationDTO;

import java.util.List;

/**
 * @author 吴峰
 * @date 2020/09/29 14:16
 */
public interface BusinessRuleDynamicValueService {

    /**
     * 处理动态值，多个数据计算，其中有累加，累减
     * @param operationsPojo
     * @param thisField 当前表单字段
     * @param targetField 目标表单字段
     * @param item 当前表单的数据
     * @param targetData 目标表单的数据或者子表单的数据
     * @param operationDTO
     * @param thisData 当前表单的数据
     * @return java.lang.Object
     * @author 吴峰
     * @date 2021/1/22 19:54
     * @throws XbbException
     */
    Object dynamicValueOfMultiple(OperationsPojo operationsPojo, FieldAttrEntity thisField, FieldAttrEntity targetField, PaasFormDataEntityExt item, JSONObject targetData,
                    OperationDTO operationDTO, List<JSONObject> thisData) throws XbbException;

    /**
     * 处理动态值
     * @param operationsPojo
     * @param thisField  当前表单字段
     * @param targetField 目标表单字段
     * @param item 当前表单的数据
     * @param targetData 目标表单的数据或者子表单的数据
     * @param operationDTO
     * @param thisData 当前表单的数据
     * @return void
     * @author 吴峰
     * @date 2020/9/29 14:18
     * @throws XbbException
     */
    Object dynamicValue(OperationsPojo operationsPojo, FieldAttrEntity thisField, FieldAttrEntity targetField, PaasFormDataEntityExt item, JSONObject targetData,
                      OperationDTO operationDTO, JSONObject thisData) throws XbbException;


    /**
     * 处理固定值
     * @param operationsPojo
     * @param targetField 目标表单字段
     * @param item 当前表单的数据
     * @param targetData 目标表单的数据
     * @param operationDTO
     * @return void
     * @author 吴峰
     * @date 2020/9/29 14:18
     * @throws XbbException
     */
    Object fixedValue(OperationsPojo operationsPojo, FieldAttrEntity targetField, PaasFormDataEntityExt item, JSONObject targetData,
                    OperationDTO operationDTO) throws XbbException;
}
